//
//  main.m
//  多个对象内存管理练习
//
//  Created by wenjim on 17/10/3.
//  Copyright © 2017年 WenJim. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Status.h"

int main(int argc, const char * argv[]) {
    /*
     模拟场景：
     ＊ 老王在2010-1-1 17:56:34 注册了一个账号
     (名称：WenJim@163.com, 密码：cwj1314)
     * 老王的生日时1986－3-8 18:18:18
     * 老王发布一条说说
     * 文字内容 @"爆米花手机比逼格更有逼格"
     * 图片：@"phone.png"
     * 发表时间：2017-10-3 1:40:20
     * 作者：老王
     * 被转发的说说:没有
     * 评论数：100
     * 转发数：90
     * 点赞数：200
     
     * 王大锤在2012-8-8 12:32:23 注册了一个账号
     (名称：wangdachui@163.com ，密码：654123)
     * 王大锤的生日是 1989-9-6 12:21:56
     * 王大锤在2017-10-4 20:32:12 时，转发了老王之前发布的说说，并且还附带了一句话：@"真的很有逼格"
     */
    
    /*
     
     至少应该有三个类:
     账号类(Account)：
         注册的时间(registertime)
         账号(email)
         密码(password)
     用户类(Author)：
         用户昵称(name)
         用户头像(icon)
         用户是否是会员(vip)
         用户对应的账号(account)
         用户的生日(birthday)
     微博类(Status)：
         微博正文(text)
         微博的配图(picture)
         微博发布的时间(createTime)
         微博对应的作者（用户）(author)
         评论数(commentCount)
         转发数(retweetCount)
         赞数(likeCount)
         转发微博(repostStatus)
     微博中有用户，用户中有账号
     1.账号   2.用户   3.微博
     
     */
    
    // 1.给老王创建账号
    Account * lwAccount = [[Account alloc] init];
    lwAccount.email = @"Wenjim@163.com";
    lwAccount.paaword = @"cwj1314";
    lwAccount.registerTime = (MyDate){2010,1,1,17,56,34};
    // 2.根据账号设置用户信息
    Author * lwAuthor = [[Author alloc] init];
    lwAuthor.name = @"老王";
    lwAuthor.icon = @"lw.png";
    lwAuthor.vip = YES;
    lwAuthor.account = lwAccount;
    lwAuthor.birthday = (MyDate){1986,3,8,18,18,18};
    
    // 3.发布微博
    Status * lwStatus = [[Status alloc] init];
    lwStatus.text = @"爆米花手机比逼格更有逼格";
    lwStatus.picture = @"phone.png";
    lwStatus.createTime = (MyDate){2017,10,3,1,40,20};
    lwStatus.author = lwAuthor;
    lwStatus.commentCount = 100;
    lwStatus.retweetCount = 90;
    lwStatus.likeCount = 200;
    
    
    // 1.给王大锤创建账号
    Account * wdcAccount = [[Account alloc] init];
    wdcAccount.email = @"wangdachui@163.com";
    wdcAccount.paaword = @"654123";
    wdcAccount.registerTime = (MyDate){2012,8,8,12,32,23};
    
    // 2.根据账号设置用户信息
    Author * wdcAuthor = [[Author alloc] init];
    wdcAuthor.name = @"王大锤";
    wdcAuthor.icon = @"wdc.png";
    wdcAuthor.vip = NO;
    wdcAuthor.account = wdcAccount;
    wdcAuthor.birthday = (MyDate){1989,9,6,12,21,56};
    
    // 3.转发微博
    Status * wdcStatus = [[Status alloc] init];
    wdcStatus.text = @"真的很有逼格";
    wdcStatus.picture = nil;
    wdcStatus.createTime = (MyDate) {2017,10,4,20,32,12};
    wdcStatus.author = wdcAuthor;
    wdcStatus.commentCount = 0;
    wdcStatus.retweetCount = 0;
    wdcStatus.likeCount = 0;
    wdcStatus.repostStatus = lwStatus;
    
    [lwAccount release];
    [lwAuthor release];
    [lwStatus release];
    
    [wdcAccount release];
    [wdcAuthor release];
    [wdcStatus release];
    
    return 0;
}
